package cj.web.admin.dao;
/*
 *  
 *  
*/
import java.util.List;
import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.admin.domain.SurveyDepotType;

/**
 * 
 * @author 
 *
 */
@DAO
public interface SurveyDepotTypeDAO{
	
	@SQL("SELECT * FROM SurveyDepotType WHERE deleteFlag=1 #if(:t.name!=''){AND name like '%##(:t.name)%' } ORDER BY updateAt DESC LIMIT :t.start,:t.length ")
    List<SurveyDepotType> query(@SQLParam("t") SurveyDepotType surveyDepotType);
	
	@SQL("SELECT count(1) FROM SurveyDepotType WHERE deleteFlag=1 #if(:t.name!=''){AND name like '%##(:t.name)%' } ")
    int querysize(@SQLParam("t") SurveyDepotType surveyDepotType);
	
	@SQL("SELECT * FROM SurveyDepotType WHERE deleteFlag=1")
    List<SurveyDepotType> queryAll();
    
    @SQL("SELECT * FROM SurveyDepotType WHERE id=:1")
    SurveyDepotType queryById(int id);
    
    @SQL("INSERT INTO SurveyDepotType (name,deleteFlag,createUser,createAt,updateUser,updateAt) VALUES (:t.name,1,:t.createUser,now(),:t.updateUser,now())")
    void create(@SQLParam("t") SurveyDepotType surveyDepotType);
	
	@SQL("UPDATE SurveyDepotType SET name=:t.name,updateUser=:t.updateUser,updateAt=now() WHERE id=:t.id")
    void update(@SQLParam("t") SurveyDepotType surveyDepotType);
    
    @SQL("UPDATE SurveyDepotType SET deleteFlag=0 WHERE id=:1")
    void deleteById(int id);
}